home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1 / Ian and Stuart's One (Australia).iso / Australasian Legends / Commercial / Rainbow Hill / MacDOS™ 2.0.0 / batches / bu1.bat < prev    next >
DOS Batch File  |  1994-07-04  |  1KB  |  55 lines

  1. @echo off
  2. !  bu1.bat    TO BE EXECUTED VIA BU.BAT AND NEVER DIRECTLY
  3. !  %1: name of source subdirectory within the current directory
  4. !  %2: full path of destination directory
  5. !  %3: file ID to be restored to the variable bu1_fileID before returning
  6. !  Copyright © 1994 by Rainbow Hill Pty Ltd. All rights reserved.
  7.  
  8.     ! ensure that bu1 is being called from within bu.bat
  9.     if "%bu_dest%" == %%BU_DEST%% goto NO_BU_LBL
  10.  
  11.     onerror DONE_LBL
  12.  
  13.     ! attach to the folder to be copied
  14.     cd "%1"
  15.  
  16.     ! backup all the files (if any)
  17.     if exist * copy/u * "%2"
  18.  
  19.     ! prepare a file with the list of all subdirectories
  20.     dir/b/a-f > BU_TEMPFILE
  21.  
  22.     ! open the file containing the list of all subdirectories
  23.     open BU_TEMPFILE bu1_fileID
  24.  
  25. :BU1_LOOP_LBL
  26.  
  27.     ! obtain a folder name (it will jump to DONE_LBL on EOF)
  28.     read %bu1_fileID% bu1_aDir
  29.  
  30.     ! remove the double quotes which enclose the name
  31.     decr -bu1_aDir
  32.     decr bu1_aDir
  33.  
  34.     ! execute bu1 recursively to backup the subdirectory
  35.     call bu1 "%bu1_aDir%" "%2\%bu1_aDir%" %bu1_fileID%
  36.  
  37.     ! loop back
  38.     goto BU1_LOOP_LBL
  39.  
  40. :NO_BU_LBL
  41.     echo.
  42.     echo bu1 should be called from within bu.bat and never executed directly.
  43.     echo.
  44.     goto RETURN_LBL
  45.  
  46. :DONE_LBL
  47.     if %doserr% == 27 set doserr=0
  48.     if %doserr% == 3 set doserr=0
  49.     close %bu1_fileID%
  50.     if exist BU_TEMPFILE del BU_TEMPFILE
  51.     cd ..
  52.     set bu1_fileID=%3
  53.     set bu1_aDir=
  54. :RETURN_LBL
  55.